Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Variable (computer science)</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Variable_(computer_science)"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Variable_computer_science rootpage-Variable_computer_science skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Variable (computer science)</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1251242444">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style>
<p>In <a href="Computer_programming" title="Computer programming">computer programming</a>, a <b>variable</b> is an abstract storage location paired with an associated <a href="Symbol" title="Symbol">symbolic name</a>, which contains some known or unknown quantity of <a href="Data_(computer_science)" title="Data (computer science)">data</a> or <a href="Object_(computer_science)" title="Object (computer science)">object</a> referred to as a <i><a href="Value_(computer_science)" title="Value (computer science)">value</a></i>; or in simpler terms, a variable is a named container for a particular set of bits or <a href="Data_type" title="Data type">type of data</a> (like <a href="Integer_(computer_science)" title="Integer (computer science)">integer</a>, <a href="Floating-point_arithmetic" title="Floating-point arithmetic">float</a>, <a href="String_(computer_science)" title="String (computer science)">string</a>, etc...).<sup id="cite_ref-FOOTNOTEBrookshear2019249&quot;Variables_and_Data_Types&quot;_1-0" class="reference"><a href="#cite_note-FOOTNOTEBrookshear2019249&quot;Variables_and_Data_Types&quot;-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> A variable can eventually be associated with or identified by a <a href="Memory_address" title="Memory address">memory address</a>. The variable name is the usual way to <a href="Reference_(computer_science)" title="Reference (computer science)">reference</a> the stored value, in addition to referring to the variable itself, depending on the context. This separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer <a href="Source_code" title="Source code">source code</a> can be <a href="Name_binding" title="Name binding">bound</a> to a <a href="Value_(computer_science)" title="Value (computer science)">value</a> during <a href="Run_time_(program_lifecycle_phase)" class="mw-redirect" title="Run time (program lifecycle phase)">run time</a>, and the value of the variable may thus change during the course of <a href="Execution_(computing)" title="Execution (computing)">program execution</a>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup>
</p><p>Variables in programming may not directly correspond to the concept of <a href="Variable_(mathematics)" title="Variable (mathematics)">variables in mathematics</a>. The latter is <a href="Abstract_and_concrete" title="Abstract and concrete">abstract</a>, having no reference to a physical object such as storage location. The value of a computing variable is not necessarily part of an <a href="Equation" title="Equation">equation</a> or <a href="Formula" title="Formula">formula</a> as in mathematics. Variables in <a href="Computer_programming" title="Computer programming">computer programming</a> are frequently given long names to make them relatively descriptive of their use, whereas variables in mathematics often have terse, one- or two-character names for brevity in transcription and manipulation.
</p><p>A variable's storage location may be referenced by several different identifiers, a situation known as <a href="Aliasing_(computing)" title="Aliasing (computing)">aliasing</a>. Assigning a value to the variable using one of the identifiers will change the value that can be accessed through the other identifiers.
</p><p><a href="Compiler_(computing)" class="mw-redirect" title="Compiler (computing)">Compilers</a> have to replace variables' symbolic names with the actual locations of the data. While a variable's name, type, and location often remain fixed, the data stored in the location may be changed during program execution.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Actions_on_a_variable">Actions on a variable</h2></div>
<p>In <a href="Imperative_programming" title="Imperative programming">imperative</a> <a href="Programming_language" title="Programming language">programming languages</a>, values can generally be <a href="Dereference" class="mw-redirect" title="Dereference">accessed</a> or <a href="Assignment_(computer_science)" title="Assignment (computer science)">changed</a> at any time. In <a href="Pure_function" title="Pure function">pure</a> <a href="Functional_programming" title="Functional programming">functional</a> and <a href="Logic_programming" title="Logic programming">logic languages</a>, variables are <a href="Free_variables_and_bound_variables" title="Free variables and bound variables">bound</a> to expressions and keep a single value during their entire <a href="Scope_(programming)" class="mw-redirect" title="Scope (programming)">lifetime</a> due to the requirements of <a href="Referential_transparency" title="Referential transparency">referential transparency</a>. In imperative languages, the same behavior is exhibited by (named) <a href="Constant_(programming)" class="mw-redirect" title="Constant (programming)">constants</a> (symbolic constants), which are typically contrasted with (normal) variables.
</p><p>Depending on the <a href="Type_system" title="Type system">type system</a> of a programming language, variables may only be able to store a specified <a href="Data_type" title="Data type">data type</a> (e.g. <a href="Integer_(computer_science)" title="Integer (computer science)">integer</a> or <a href="String_(computer_science)" title="String (computer science)">string</a>). Alternatively, a datatype may be associated only with the current value, allowing a single variable to store anything supported by the programming language. Variables are the containers for storing the values.
</p><p>Variables and scope:
</p>
<ul><li><a href="Automatic_variable" title="Automatic variable">Automatic variables</a>: Each local variable in a function comes into existence only when the <a href="Function_(computer_programming)" title="Function (computer programming)">function</a> is called, and disappears when the function is exited. Such variables are known as automatic variables.</li>
<li>External variables: These are variables that are external to a function and can be accessed by name by any function. These variables remain in existence permanently; rather than appearing and disappearing as functions are called and exited, they retain their values even after the functions that set them have returned.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="Identifiers_referencing_a_variable">Identifiers referencing a variable</h2></div>
<p>An identifier referencing a variable can be used to access the variable in order to read out the value, or alter the value, or edit other <a href="Attribute_(computing)" title="Attribute (computing)">attributes</a> of the variable, such as access permission, <a href="Lock_(computer_science)" title="Lock (computer science)">locks</a>, <a href="Semaphore_(programming)" title="Semaphore (programming)">semaphores</a>, etc.
</p><p>For instance, a variable might be referenced by the identifier "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">total_count</code>" and the variable can contain the number 1956. If the same variable is referenced by the identifier "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">r</code>" as well, and if using this identifier "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">r</code>", the value of the variable is altered to 2009, then reading the value using the identifier "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">total_count</code>" will yield a result of 2009 and not 1956.
</p><p>If a variable is only referenced by a single identifier, that identifier can simply be called <i>the name of the variable</i>; otherwise, we can speak of it as <i>one of the names of the variable</i>. For instance, in the previous example the identifier "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">total_count</code>" is the name of the variable in question, and "<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">r</code>" is another name of the same variable.
</p>
<div class="mw-heading mw-heading2"><h2 id="Scope_and_extent">Scope and extent</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">See also: <a href="Free_variables_and_bound_variables" title="Free variables and bound variables">Free variables and bound variables</a></div>
<p>The <i><a href="Scope_(computer_science)" title="Scope (computer science)">scope</a></i> of a variable describes where in a program's text the variable may be used, while the <i>extent</i> (also called <i>lifetime</i>) of a variable describes when in a program's execution the variable has a (meaningful) value. The scope of a variable affects its extent. The scope of a variable is actually a property of the name of the variable, and the extent is a property of the storage location of the variable. These should not be confused with <i>context</i> (also called <i>environment</i>), which is a property of the program, and varies by point in the program's text or execution—see <a href="Scope_(computer_science)#Overview" title="Scope (computer science)">scope: an overview</a>. Further, <a href="Object_lifetime" title="Object lifetime">object lifetime</a> may coincide with variable lifetime, but in many cases is not tied to it.
</p><p><i>Scope</i> is an important part of the <a href="Name_resolution_(programming_languages)" title="Name resolution (programming languages)">name resolution</a> of a variable. Most languages define a specific <i>scope</i> for each variable (as well as any other named entity), which may differ within a given program. The scope of a variable is the portion of the program's text for which the variable's name has meaning and for which the variable is said to be "visible". Entrance into that scope typically begins a variable's lifetime (as it comes into context) and exit from that scope typically ends its lifetime (as it goes out of context). For instance, a variable with "<a href="Lexical_scope" class="mw-redirect" title="Lexical scope">lexical scope</a>" is meaningful only within a certain function/<a href="Subroutine" class="mw-redirect" title="Subroutine">subroutine</a>, or more finely within a block of expressions/statements (accordingly with <a href="Function_scope" class="mw-redirect" title="Function scope">function scope</a> or <a href="Block_scope" class="mw-redirect" title="Block scope">block scope</a>); this is static resolution, performable at parse-time or compile-time. Alternatively, a variable with <a href="Dynamic_scope" class="mw-redirect" title="Dynamic scope">dynamic scope</a> is resolved at run-time, based on a global binding <a href="Stack_(abstract_data_type)" title="Stack (abstract data type)">stack</a> that depends on the specific <a href="Control_flow" title="Control flow">control flow</a>. Variables only accessible within a certain functions are termed "<a href="Local_variable" title="Local variable">local variables</a>". A "<a href="Global_variable" title="Global variable">global variable</a>", or one with indefinite scope, may be referred to anywhere in the program.
</p><p><i>Extent</i>, on the other hand, is a runtime (<a href="Dynamic_variable_scoping" class="mw-redirect" title="Dynamic variable scoping">dynamic</a>) aspect of a variable. Each <a href="Name_binding" title="Name binding">binding</a> of a variable to a value can have its own <i>extent</i> at runtime. The extent of the binding is the portion of the program's execution time during which the variable continues to refer to the same value or memory location. A running program may enter and leave a given extent many times, as in the case of a <a href="Closure_(computer_science)" class="mw-redirect" title="Closure (computer science)">closure</a>.
</p><p>Unless the programming language features <a href="Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage collection</a>, a variable whose extent permanently outlasts its scope can result in a <a href="Memory_leak" title="Memory leak">memory leak</a>, whereby the memory allocated for the variable can never be freed since the variable which would be used to reference it for deallocation purposes is no longer accessible. However, it can be permissible for a variable binding to extend beyond its scope, as occurs in Lisp <a href="Closure_(computer_science)" class="mw-redirect" title="Closure (computer science)">closures</a> and C <a href="Static_local_variable" class="mw-redirect" title="Static local variable">static local variables</a>; when execution passes back into the variable's scope, the variable may once again be used. A variable whose scope begins before its extent does is said to be <i><a href="Uninitialized_variable" title="Uninitialized variable">uninitialized</a></i> and often has an undefined, arbitrary value if accessed (see <a href="Wild_pointer" class="mw-redirect" title="Wild pointer">wild pointer</a>), since it has yet to be explicitly given a particular value. A variable whose extent ends before its scope may become a <a href="Dangling_pointer" title="Dangling pointer">dangling pointer</a> and deemed uninitialized once more since its value has been destroyed. Variables described by the previous two cases may be said to be <i>out of extent</i> or <i>unbound</i>. In many languages, it is an error to try to use the value of a variable when it is out of extent. In other languages, doing so may yield <a href="Undefined_behavior" title="Undefined behavior">unpredictable results</a>. Such a variable may, however, be assigned a new value, which gives it a new extent.
</p><p>For space efficiency, a memory space needed for a variable may be allocated only when the variable is first used and freed when it is no longer needed. A variable is only needed when it is in scope, thus beginning each variable's lifetime when it enters scope may give space to unused variables. To avoid wasting such space, compilers often warn programmers if a variable is declared but not used.
</p><p>It is considered good programming practice to make the scope of variables as narrow as feasible so that different parts of a program do not accidentally interact with each other by modifying each other's variables. Doing so also prevents <a href="Action_at_distance_(computer_science)" class="mw-redirect" title="Action at distance (computer science)">action at a distance</a>. Common techniques for doing so are to have different sections of a program use different <a href="Namespace_(programming)" class="mw-redirect" title="Namespace (programming)">name spaces</a>, or to make individual variables "private" through either <a href="Dynamic_variable_scoping" class="mw-redirect" title="Dynamic variable scoping">dynamic variable scoping</a> or <a href="Lexical_variable_scoping" class="mw-redirect" title="Lexical variable scoping">lexical variable scoping</a>.
</p><p>Many programming languages employ a reserved value (often named <i><a href="Null_pointer" title="Null pointer">null</a></i> or <i>nil</i>) to indicate an invalid or uninitialized variable.
</p>
<div class="mw-heading mw-heading2"><h2 id="Typing">Typing</h2></div>
<div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Type_system" title="Type system">Type system</a></div>
<div role="note" class="hatnote navigation-not-searchable">See also: <a href="Datatype" class="mw-redirect" title="Datatype">Datatype</a></div>
<p>In <a href="Static_typing" class="mw-redirect" title="Static typing">statically typed</a> languages such as <a href="C_(programming_language)" title="C (programming language)">C</a>, <a href="C%2B%2B" title="C++">C++</a>, <a href="Java_(programming_language)" title="Java (programming language)">Java</a> or <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>, a variable also has a <i>type</i>, meaning that only certain kinds of values can be stored in it. For example, a variable of type "<a href="Integer_(computer_science)" title="Integer (computer science)">integer</a>" is prohibited from storing text values.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p><p>In <a href="Dynamic_typing" class="mw-redirect" title="Dynamic typing">dynamically typed</a> languages such as <a href="Python_(programming_language)" title="Python (programming language)">Python</a>, a variable's type is inferred by its value, and can change according to its value. In <a href="Common_Lisp" title="Common Lisp">Common Lisp</a>, both situations exist simultaneously: A variable is given a type (if undeclared, it is assumed to be <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">T</code>, the universal <a href="Subtyping" title="Subtyping">supertype</a>) which exists at compile time. Values also have types, which can be checked and queried at runtime.
</p><p>Typing of variables also allows <a href="Type_polymorphism" class="mw-redirect" title="Type polymorphism">polymorphisms</a> to be resolved at compile time. However, this is different from the polymorphism used in object-oriented function calls (referred to as <i><a href="Virtual_functions" class="mw-redirect" title="Virtual functions">virtual functions</a></i> in <a href="C%2B%2B" title="C++">C++</a>) which resolves the call based on the value type as opposed to the supertypes the variable is allowed to have.
</p><p>Variables often store simple data, like integers and literal strings, but some programming languages allow a variable to store values of other <a href="Datatype" class="mw-redirect" title="Datatype">datatypes</a> as well. Such languages may also enable functions to be <a href="Parametric_polymorphism#Parametric_polymorphism" title="Parametric polymorphism">parametric polymorphic</a>. These functions operate like variables to represent data of multiple types. For example, a function named <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">length</code> may determine the length of a list. Such a <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">length</code> function may be parametric polymorphic by including a type variable in its <a href="Type_signature" title="Type signature">type signature</a>, since the number of elements in the list is independent of the elements' types.
</p>
<div class="mw-heading mw-heading2"><h2 id="Parameters">Parameters</h2></div>
<p>The <i>formal parameters</i> (or <i>formal arguments</i>) of functions are also referred to as variables. For instance, in this <a href="Python_(programming_language)" title="Python (programming language)">Python</a> code segment,
</p>
<div class="mw-highlight mw-highlight-lang-pycon mw-content-ltr" dir="ltr"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">def</span><span class="w"> </span><span class="nf">add_two</span><span class="p">(</span><span class="n">x</span><span class="p">):</span>
<span class="gp">... </span> <span class="k">return</span> <span class="n">x</span> <span class="o">+</span> <span class="mi">2</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">add_two</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
<span class="go">7</span>
</pre></div>
<p>the variable named <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">x</code> is a <i><a href="Parameter_(computer_programming)" title="Parameter (computer programming)">parameter</a></i> because it is given a value when the function is called. The integer 5 is the <i>argument</i> which gives <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">x</code> its value. In most languages, function parameters have local scope. This specific variable named <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">x</code> can only be referred to within the <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">add_two</code> function (though of course other functions can also have variables called <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">x</code>).
</p>
<div class="mw-heading mw-heading2"><h2 id="Memory_allocation">Memory allocation</h2></div>
<p>The specifics of variable allocation and the representation of their values vary widely, both among programming languages and among implementations of a given language. Many language implementations allocate space for <i><a href="Local_variable" title="Local variable">local variables</a></i>, whose extent lasts for a single function call on the <i><a href="Call_stack" title="Call stack">call stack</a></i>, and whose memory is automatically reclaimed when the function returns. More generally, in <i><a href="Name_binding" title="Name binding">name binding</a></i>, the name of a variable is bound to the address of some particular block (contiguous sequence) of bytes in memory, and operations on the variable manipulate that block. <a href="Reference_(computer_science)" title="Reference (computer science)">Referencing</a> is more common for variables whose values have large or unknown sizes when the code is compiled. Such variables reference the location of the value instead of storing the value itself, which is allocated from a pool of memory called the <i><a href="Dynamic_memory_allocation" class="mw-redirect" title="Dynamic memory allocation">heap</a></i>.
</p><p>Bound variables have values. A value, however, is an abstraction, an idea; in implementation, a value is represented by some <i><a href="Object_(computer_science)" title="Object (computer science)">data object</a></i>, which is stored somewhere in computer memory. The program, or the <a href="Runtime_environment" class="mw-redirect" title="Runtime environment">runtime environment</a>, must set aside memory for each data object and, since memory is finite, ensure that this memory is yielded for reuse when the object is no longer needed to represent some variable's value.
</p><p>Objects allocated from the heap must be reclaimed—especially when the objects are no longer needed. In a <a href="Garbage_collection_(computer_science)" title="Garbage collection (computer science)">garbage-collected</a> language (such as <a href="C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>, <a href="Java_(programming_language)" title="Java (programming language)">Java</a>, Python, Golang and <a href="Lisp_(programming_language)" title="Lisp (programming language)">Lisp</a>), the runtime environment automatically reclaims objects when extant variables can no longer refer to them. In non-garbage-collected languages, such as <a href="C_(programming_language)" title="C (programming language)">C</a>, the program (and the programmer) must explicitly <a href="Malloc" class="mw-redirect" title="Malloc">allocate</a> memory, and then later free it, to reclaim its memory. Failure to do so leads to <a href="Memory_leak" title="Memory leak">memory leaks</a>, in which the heap is depleted as the program runs, risks eventual failure from exhausting available memory.
</p><p>When a variable refers to a <a href="Data_structure" title="Data structure">data structure</a> created dynamically, some of its components may be only indirectly accessed through the variable. In such circumstances, garbage collectors (or analogous program features in languages that lack garbage collectors) must deal with a case where only a portion of the memory reachable from the variable needs to be reclaimed.
</p>
<div class="mw-heading mw-heading2"><h2 id="Naming_conventions">Naming conventions</h2></div>
<div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Naming_conventions_(programming)" class="mw-redirect" title="Naming conventions (programming)">Naming conventions (programming)</a></div>
<div role="note" class="hatnote navigation-not-searchable">See also: <a href="Identifier_(computer_languages)" title="Identifier (computer languages)">Identifier (computer languages)</a> and <a href="Namespace" title="Namespace">Namespace</a></div>
<p>Unlike their mathematical counterparts, programming variables and constants commonly take multiple-character names, e.g. <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">COST</code> or <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">total</code>. Single-character names are most commonly used only for auxiliary variables; for instance, <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">i</code>, <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">j</code>, <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">k</code> for <a href="Array_index" class="mw-redirect" title="Array index">array index</a> variables.
</p><p>Some naming conventions are enforced at the language level as part of the language syntax which involves the format of valid identifiers. In almost all languages, variable names cannot start with a digit (0–9) and cannot contain whitespace characters. Whether or not punctuation marks are permitted in variable names varies from language to language; many languages only permit the <a href="Underscore" title="Underscore">underscore</a> ("_") in variable names and forbid all other punctuation. In some programming languages, <a href="Sigil_(computer_programming)" title="Sigil (computer programming)">sigils</a> (symbols or punctuation) are affixed to variable identifiers to indicate the variable's datatype or scope.
</p><p><a href="Case-sensitivity" class="mw-redirect" title="Case-sensitivity">Case-sensitivity</a> of variable names also varies between languages and some languages require the use of a certain case in naming certain entities;<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>note 1<span class="cite-bracket">]</span></a></sup> Most modern languages are case-sensitive; some older languages are not. Some languages reserve certain forms of variable names for their own internal use; in many languages, names beginning with two underscores ("__") often fall under this category.
</p><p>However, beyond the basic restrictions imposed by a language, the naming of variables is largely a matter of style. At the <a href="Machine_code" title="Machine code">machine code</a> level, variable names are not used, so the exact names chosen do not matter to the computer. Thus names of variables identify them, for the rest they are just a tool for programmers to make programs easier to write and understand. Using poorly chosen variable names can make code more difficult to review than non-descriptive names, so names that are clear are often encouraged.<sup id="cite_ref-Choosing_good_variable_names_8-0" class="reference"><a href="#cite_note-Choosing_good_variable_names-8"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-EWD1044_9-0" class="reference"><a href="#cite_note-EWD1044-9"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p><p>Programmers often create and adhere to code style guidelines that offer guidance on naming variables or impose a precise naming scheme. Shorter names are faster to type but are less descriptive; longer names often make programs easier to read and the purpose of variables easier to understand. However, extreme verbosity in variable names can also lead to less comprehensible code.
</p>
<div class="mw-heading mw-heading2"><h2 id="Variable_types_(based_on_lifetime)">Variable types (based on lifetime)</h2></div>
<p>We can classify variables based on their lifetime. The different types of variables are static, stack-dynamic, explicit heap-dynamic, and implicit heap-dynamic. A <a href="Static_variable" title="Static variable">static variable</a> is also known as global variable, it is bound to a memory cell before execution begins and remains to the same memory cell until termination. A typical example is the static variables in C and C++. A Stack-dynamic variable is known as local variable, which is bound when the declaration statement is executed, and it is deallocated when the procedure returns. The main examples are local variables in C subprograms and Java methods. Explicit Heap-Dynamic variables are nameless (abstract) memory cells that are allocated and deallocated by explicit run-time instructions specified by the programmer. The main examples are dynamic objects in C++ (via new and delete) and all objects in Java. Implicit Heap-Dynamic variables are bound to heap storage only when they are assigned values. Allocation and release occur when values are reassigned to variables. As a result, Implicit heap-dynamic variables have the highest degree of flexibility. The main examples are some variables in JavaScript, PHP and all variables in APL.
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1266661725">
/* start https://en.wikipedia.org/ */


.mw-parser-output .portalbox{padding:0;margin:0.5em 0;display:table;box-sizing:border-box;max-width:175px;list-style:none}.mw-parser-output .portalborder{border:1px solid var(--border-color-base,#a2a9b1);padding:0.1em;background:var(--background-color-neutral-subtle,#f8f9fa)}.mw-parser-output .portalbox-entry{display:table-row;font-size:85%;line-height:110%;height:1.9em;font-style:italic;font-weight:bold}.mw-parser-output .portalbox-image{display:table-cell;padding:0.2em;vertical-align:middle;text-align:center}.mw-parser-output .portalbox-link{display:table-cell;padding:0.2em 0.2em 0.2em 0.3em;vertical-align:middle}@media(min-width:720px){.mw-parser-output .portalleft{margin:0.5em 1em 0.5em 0}.mw-parser-output .portalright{clear:right;float:right;margin:0.5em 0 0.5em 1em}}


/* end https://en.wikipedia.org/ */
</style>
<ul><li><a href="Control_variable_(programming)" class="mw-redirect" title="Control variable (programming)">Control variable (programming)</a></li>
<li><a href="Non-local_variable" title="Non-local variable">Non-local variable</a></li>
<li><a href="Temporary_variable" title="Temporary variable">Temporary variable</a></li>
<li><a href="Variable_interpolation" class="mw-redirect" title="Variable interpolation">Variable interpolation</a></li>
<li><a href="Scalar_(mathematics)" title="Scalar (mathematics)">Scalar (mathematics)</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text">For example, <a href="Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a> requires that names of types start with a capital letter.</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-FOOTNOTEBrookshear2019249&quot;Variables_and_Data_Types&quot;-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEBrookshear2019249&quot;Variables_and_Data_Types&quot;_1-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFBrookshear2019">Brookshear 2019</a>, p.&nbsp;249, "Variables and Data Types", "high-level programming languages allow locations in main memory to be referenced by descriptive names rather than by numeric addresses."</span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFAhoSethiUllman1986" class="citation cs2">Aho, Alfred V.; Sethi, Ravi; Ullman, Jeffrey D. (1986), <i><a href="Compilers%3A_Principles%2C_Techniques%2C_and_Tools" title="Compilers: Principles, Techniques, and Tools">Compilers: Principles, Techniques, and Tools</a></i>, pp.&nbsp;<span class="nowrap">26–</span>28, <a href="Bibcode_(identifier)" class="mw-redirect" title="Bibcode (identifier)">Bibcode</a>:<a rel="nofollow" class="external text" href="https://ui.adsabs.harvard.edu/abs/1986cptt.book.....A">1986cptt.book.....A</a></cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFKnuth1997" class="citation book cs1">Knuth, Donald (1997). <i>The Art of Computer Programming</i>. Vol.&nbsp;1 (3rd&nbsp;ed.). Reading, Massachusetts: Addison-Wesley. pp.&nbsp;<span class="nowrap">3–</span>4. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-201-89683-4</bdi>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.khanacademy.org/computing/ap-computer-science-principles/programming-101/storing-variables/a/assigning-variables">"Programming with variables"</a>. <i>Khan Academy</i><span class="reference-accessdate">. Retrieved <span class="nowrap">23 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20200323124927/https://cs.harvard.edu/malan/scratch/variables.php">"Scratch for Budding Coders"</a>. Harvard. Archived from <a rel="nofollow" class="external text" href="https://cs.harvard.edu/malan/scratch/variables.php">the original</a> on 23 March 2020<span class="reference-accessdate">. Retrieved <span class="nowrap">23 March</span> 2020</span>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://developer.mozilla.org/en-US/docs/Glossary/Static_typing">"Static typing - MDN Web Docs Glossary: Definitions of Web-related terms | MDN"</a>. <i>developer.mozilla.org</i>. 2023-06-08<span class="reference-accessdate">. Retrieved <span class="nowrap">2024-05-06</span></span>.</cite></span>
</li>
<li id="cite_note-Choosing_good_variable_names-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-Choosing_good_variable_names_8-0">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.dotcadot.ca/articles/how-not-pick-variables">How Not To Pick Variables</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20161221163819/http://www.dotcadot.ca/articles/how-not-pick-variables">Archived</a> 2016-12-21 at the <a href="Wayback_Machine" title="Wayback Machine">Wayback Machine</a>, Retrieved July 11, 2012 [DEAD LINK]</span>
</li>
<li id="cite_note-EWD1044-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-EWD1044_9-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFEdsger_Dijkstra" class="citation cs2"><a href="Edsger_Dijkstra" class="mw-redirect" title="Edsger Dijkstra">Edsger Dijkstra</a>, <a rel="nofollow" class="external text" href="http://www.cs.utexas.edu/users/EWD/transcriptions/EWD10xx/EWD1044.html"><i>To hell with "meaningful identifiers"!</i></a></cite></span>
</li>
</ol></div>
<div class="mw-heading mw-heading3"><h3 id="Works_cited">Works cited</h3></div>
<ul><li><cite id="CITEREFBrookshear2019" class="citation web cs1">Brookshear, J. Glenn (2019). <a rel="nofollow" class="external text" href="https://www.r-5.org/files/books/computers/overviews/software/Glenn_Brookshear-Computer_Science_An_Overview-EN.pdf">"Computer Science: An Overview"</a> <span class="cs1-format">(PDF)</span><span class="reference-accessdate">. Retrieved <span class="nowrap">2024-04-01</span></span>.</cite></li></ul>
<div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}


/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1236075235">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style></div><div role="navigation" class="navbox" aria-labelledby="Data_types177" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div id="Data_types177" style="font-size:114%;margin:0 4em"><a href="Data_type" title="Data type">Data types</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Units_of_information" title="Units of information">Uninterpreted</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Bit" title="Bit">Bit</a></li>
<li><a href="Byte" title="Byte">Byte</a></li>
<li><a href="Ternary_numeral_system" title="Ternary numeral system">Trit</a></li>
<li><a href="Ternary_numeral_system#Tryte" title="Ternary numeral system">Tryte</a></li>
<li><a href="Word_(computer_architecture)" title="Word (computer architecture)">Word</a></li>
<li><a href="Bit_array" title="Bit array">Bit array</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Numeric</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Arbitrary-precision_arithmetic" title="Arbitrary-precision arithmetic">Arbitrary-precision or bignum</a></li>
<li><a href="Complex_data_type" title="Complex data type">Complex</a></li>
<li><a href="Decimal_data_type" title="Decimal data type">Decimal</a></li>
<li><a href="Fixed-point_arithmetic" title="Fixed-point arithmetic">Fixed point</a></li>
<li><a href="Block_floating_point" title="Block floating point">Block floating point</a></li>
<li><a href="Floating-point_arithmetic" title="Floating-point arithmetic">Floating point</a>
<ul><li>Reduced precision
<ul><li><a href="Minifloat" title="Minifloat">Minifloat</a></li>
<li><a href="Half-precision_floating-point_format" title="Half-precision floating-point format">Half precision</a></li>
<li><a href="Bfloat16_floating-point_format" title="Bfloat16 floating-point format">bfloat16</a></li></ul></li>
<li><a href="Single-precision_floating-point_format" title="Single-precision floating-point format">Single precision</a></li>
<li><a href="Double-precision_floating-point_format" title="Double-precision floating-point format">Double precision</a></li>
<li><a href="Quadruple-precision_floating-point_format" title="Quadruple-precision floating-point format">Quadruple precision</a></li>
<li><a href="Octuple-precision_floating-point_format" title="Octuple-precision floating-point format">Octuple precision</a></li>
<li><a href="Extended_precision" title="Extended precision">Extended precision</a>
<ul><li><a href="Long_double" title="Long double">Long double</a></li></ul></li></ul></li>
<li><a href="Integer_(computer_science)" title="Integer (computer science)">Integer</a>
<ul><li><a href="Signedness" title="Signedness">signedness</a></li></ul></li>
<li><a href="Interval_arithmetic#Implementations" title="Interval arithmetic">Interval</a></li>
<li><a href="Rational_data_type" title="Rational data type">Rational</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Pointer_(computer_programming)" title="Pointer (computer programming)">Pointer</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Memory_address" title="Memory address">Address</a>
<ul><li><a href="Physical_address" title="Physical address">physical</a></li>
<li><a href="Virtual_address_space" title="Virtual address space">virtual</a></li></ul></li>
<li><a href="Reference_(computer_science)" title="Reference (computer science)">Reference</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Plain_text" title="Plain text">Text</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Character_(computing)" title="Character (computing)">Character</a></li>
<li><a href="String_(computer_science)" title="String (computer science)">String</a>
<ul><li><a href="Null-terminated_string" title="Null-terminated string">null-terminated</a></li></ul></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Composite_data_type" title="Composite data type">Composite</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Algebraic_data_type" title="Algebraic data type">Algebraic data type</a>
<ul><li><a href="Generalized_algebraic_data_type" title="Generalized algebraic data type">generalized</a></li></ul></li>
<li><a href="Array_(data_type)" title="Array (data type)">Array</a></li>
<li><a href="Associative_array" title="Associative array">Associative array</a></li>
<li><a href="Class_(computer_programming)" title="Class (computer programming)">Class</a></li>
<li><a href="Dependent_type" title="Dependent type">Dependent</a></li>
<li><a href="Intuitionistic_type_theory#Equality_type" title="Intuitionistic type theory">Equality</a></li>
<li><a href="Inductive_type" title="Inductive type">Inductive</a></li>
<li><a href="Intersection_type" title="Intersection type">Intersection</a></li>
<li><a href="List_(abstract_data_type)" title="List (abstract data type)">List</a></li>
<li><a href="Object_(computer_science)" title="Object (computer science)">Object</a>
<ul><li><a href="Metaobject" title="Metaobject">metaobject</a></li></ul></li>
<li><a href="Option_type" title="Option type">Option type</a></li>
<li><a href="Product_type" title="Product type">Product</a></li>
<li><a href="Record_(computer_science)" title="Record (computer science)">Record or Struct</a></li>
<li><a href="Refinement_type" title="Refinement type">Refinement</a></li>
<li><a href="Set_(abstract_data_type)" title="Set (abstract data type)">Set</a></li>
<li><a href="Union_type" title="Union type">Union</a>
<ul><li><a href="Tagged_union" title="Tagged union">tagged</a></li></ul></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Boolean_data_type" title="Boolean data type">Boolean</a></li>
<li><a href="Bottom_type" title="Bottom type">Bottom type</a></li>
<li><a href="Container_(abstract_data_type)" title="Container (abstract data type)">Collection</a></li>
<li><a href="Enumerated_type" title="Enumerated type">Enumerated type</a></li>
<li><a href="Exception_handling" title="Exception handling">Exception</a></li>
<li><a href="Function_type" title="Function type">Function type</a></li>
<li><a href="Opaque_data_type" title="Opaque data type">Opaque data type</a></li>
<li><a href="Recursive_data_type" title="Recursive data type">Recursive data type</a></li>
<li><a href="Semaphore_(programming)" title="Semaphore (programming)">Semaphore</a></li>
<li><a href="Stream_(computing)" title="Stream (computing)">Stream</a></li>
<li><a href="Strongly_typed_identifier" title="Strongly typed identifier">Strongly typed identifier</a></li>
<li><a href="Top_type" class="mw-redirect" title="Top type">Top type</a></li>
<li><a href="Type_class" title="Type class">Type class</a></li>
<li><a href="Empty_type" title="Empty type">Empty type</a></li>
<li><a href="Unit_type" title="Unit type">Unit type</a></li>
<li><a href="Void_type" title="Void type">Void</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Related<br>topics</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Abstract_data_type" title="Abstract data type">Abstract data type</a></li>
<li><a href="Boxing_(computer_programming)" title="Boxing (computer programming)">Boxing</a></li>
<li><a href="Data_structure" title="Data structure">Data structure</a></li>
<li><a href="Generic_programming" title="Generic programming">Generic</a></li>
<li><a href="Kind_(type_theory)" title="Kind (type theory)">Kind</a>
<ul><li><a href="Metaclass" title="Metaclass">metaclass</a></li></ul></li>
<li><a href="Parametric_polymorphism" title="Parametric polymorphism">Parametric polymorphism</a></li>
<li><a href="Primitive_data_type" title="Primitive data type">Primitive data type</a></li>
<li><a href="Interface_(object-oriented_programming)" title="Interface (object-oriented programming)">Interface</a></li>
<li><a href="Subtyping" title="Subtyping">Subtyping</a></li>
<li><a href="Type_constructor" title="Type constructor">Type constructor</a></li>
<li><a href="Type_conversion" title="Type conversion">Type conversion</a></li>
<li><a href="Type_system" title="Type system">Type system</a></li>
<li><a href="Type_theory" title="Type theory">Type theory</a></li>
</ul>
</div></td></tr></tbody></table></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-25" href="https://en.wikipedia.org/wiki/?title=Variable_(computer_science)&amp;oldid=1302426550">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>